package com.aqie.rabbit.controller;

import com.aqie.rabbit.bean.api.base.CodeMsg;
import com.aqie.rabbit.bean.api.base.ResponseModel;
import com.aqie.rabbit.exception.GlobalException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class TestController {

    @GetMapping("/")
    public String hello(){
        // throw new RuntimeException("i am error");
        return "hello rabbit chat!";
    }

    @GetMapping("/testSuccess")
    public ResponseModel testSuccess(){
        return ResponseModel.success("成功");
    }

    @GetMapping("/testError")
    public ResponseModel testError(){
        String msg = CodeMsg.PARAMETER_ERROR.getMsg();
        throw new GlobalException(CodeMsg.USER_MOBILE_NOT_FOUND_ERROR);
    }

    @GetMapping("/cache/global/img/gs.gif")
    public ResponseModel cache(){
        return ResponseModel.success("hello world");
    }
}
